//
// Created by fengg on 2020/2/26.
//

#include<stdio.h>
#include<stdlib.h>

typedef  struct  linknode
{
    int  data;
    struct  linknode  *link;
} ListNode,*LinkList;

ListNode  *Create(int  n)                                            /*创建链表*/
{
    ListNode  *list=NULL,  *pf,  *pb;
    int  i;
    for(i=0;i<n;i++)
    {
        pb=(ListNode  *)malloc(sizeof(ListNode));  /*开辟空间*/
        scanf("%d",  &pb->data);
        pb->link=NULL;
        if(i==0)                                /*如果是第一个结点*/
            list=pb;
        else                                        /*否则，插入结点到链表尾部*/
            pf->link=pb;
        pf=pb;                                        /*移动链表的尾指针*/
    }

    return(list);                                /*返回链表的头指针*/
}

void DEL(LinkList  list)
{
    LinkList target = list;
    LinkList previous = target;
    LinkList next = target->link;
    while(next != NULL){
        while (next != NULL){

            if(target->data == next->data){
                previous->link = next->link;
                free(next);
                next = previous->link;
            } else {
                next = next->link;
                previous = previous->link;
            }

        }
        target = target->link;
        if(target == NULL)
            break;
        previous = target;
        next = target->link;
    }



}


void  Show(ListNode  *h)
{
    ListNode  *p=h;
    do
    {
        printf  ("%d  ",p->data);
        p=p->link;
    }while  (p!=NULL);
}
int  main(void)
{
    LinkList  list;
    int  n;
    scanf("%d",&n);      //输入单链表的结点个数
    list=Create(n);
    DEL(list);
    Show(list);
    return  0;
}